

<#-- 遍历数组 -->
<#list locates as locate >
    ${locate} <br>
</#list>

<br>

<#-- 遍历数组 -->
<#list locates as locate >
    取元素值 -> ${locate},    取索引 -> ${locate?index} <br>
</#list>

<p>取长度${locates?size}</p>

<p>取首个元素 ${locates?first} </p>

<p>取尾个元素 ${locates?last} </p>

<hr>

<#list cityList as city > <#-- 正常遍历 -->
    <p>${city?index} ${city} </p>
</#list>

<hr>

<#list cityList?reverse as city > <#-- reverse 只是把顺序倒换了一下 -->
    <p>${city?index} ${city} </p>
</#list>

<hr>

<#list cityList?sort as city > <#-- 排序 -->
    <p>${city?index} ${city} </p>
</#list>
<hr>
<#list cityList?sort?reverse as city > <#-- 降序 -->
    <p>${city?index} ${city} </p>
</#list>

<hr>

<table>
    <tr>
        <th>主键</th>
        <th>名称</th>
        <th>年龄</th>
        <th>性别</th>
    </tr>
    <#list userList?sort_by("age")?reverse as user >
    <tr>
        <td>${user.id}</td>
        <td>${user.name}</td>
        <td>${user.age}</td>
        <td>${user.gender?c}</td>
    </tr>
    </#list>
</table>


<hr>

<#list map?keys as key >
    <p>键 -> ${key}, 由键取值 -> ${map[key]}</p>
</#list>

<#list map?values as value >
    <p>值 -> ${value}</p>
    <#else >
    <#-- 如果没有元素，执行ELSE的内容 -->
</#list>

<#import "fmt-04.ftl" as fmt04> <#-- 导入模板文件，并且别名 -->

<@fmt04.text>调用成功</@fmt04.text> <#-- 调用该模板文件内的自定义指令 -->

<#include "Hello.html">

